package com.exposit.books.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.exposit.books.dao.BookDAO;
import com.exposit.books.domain.Book;

@Service
@Transactional
public class BookServiceImpl implements BookService{

	@Autowired
	private BookDAO bookDAO;
	
	@Override
	public void saveBooks(List<Book> books) {
		for (Book book : books)
		{
			bookDAO.save(book);
		}
	}

	@Override
	public Book getBookById(Long id) {
		return bookDAO.getById(id);
	}

	@Override
	public void updateBook(Book book) {
		bookDAO.update(book);
	}
}
